home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1996-01-26 | 2.0 KB | 66 lines |
- ' ********************************************************
- ' *** ***
- ' *** Polygon Procedure ***
- ' *** ***
- ' *** by ***
- ' *** ***
- ' *** Joseph Bolin ***
- ' *** ***
- ' ********************************************************
-
- Screen Open 0,320,200,4,Lowres
- Curs Off : Flash Off : Paper 0 : Cls 0
- Palette $0,$FFF,$A0A
- Ink 1,2
- For X=0 To 6
- _POLYGON[X*45+20,25,3,20,20,X*20,1]
- Next
- Set Pattern 13
- _POLYGON[160,90,20,50,30,25,1]
- _POLYGON[50,90,5,30,30,30,0]
- For R=0 To 9
- _POLYGON[270,90,3,35,35,R*12,0]
- Next
- ML=360/(X+3)/10
- For X=0 To 3
- HG=9 : If X and 1 Then HG=4
- For R=0 To HG
- _POLYGON[40+X*80,160,X+3,36,15,R*36,0]
- Next
- Next
-
- Procedure _POLYGON[_XPOS,_YPOS,_POINTS,_WIDTH,_HEIGHT,_ROTATE,_FILLED]
-
- ' Inputs: _XPOS,_YPOS Center of polygon
- ' _POINTS Number of points in polygon
- ' _WIDTH Width of polygon
- ' _HEIGHT Height of polygon
- ' _ROTATE Rotation angle of polygon
- ' _FILLED Flag for fill:0=No, 1=Yes
- '
- ' Output: Draws a regular polygon on the current screen
- ' with the current ink colors and the current pattern
-
- Degree
- If _POINTS<3
- _POINTS=3
- End If
- If _POINTS>360
- _POINTS=360
- End If
- OX=_WIDTH*Cos(_ROTATE)+_XPOS+0.5
- OY=_WIDTH*Sin(_ROTATE)+_YPOS+0.5
- For R=360/_POINTS To 359+360/_POINTS Step 360/_POINTS
- NX#=Cos(R)*_WIDTH
- NY#=Sin(R)*_HEIGHT
- X=NX#*Cos(_ROTATE)-NY#*Sin(_ROTATE)+_XPOS+0.5
- Y=NY#*Cos(_ROTATE)+NX#*Sin(_ROTATE)+_YPOS+0.5
- If _FILLED<>1
- Polyline OX,OY To X,Y
- End If
- If _FILLED=1
- Polygon _XPOS,_YPOS To OX,OY To X,Y
- End If
- OX=X : OY=Y
- Next
- End Proc